home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / Open Prolog / Documents / The Draw Predicate - OP < prev   
Text File  |  1993-09-16  |  2KB  |  76 lines

  1. The draw/3 predicate in Open Prolog.
  2.  
  3. The draw/3 predicate is a fairly buggy graphics interface to Open Prolog.
  4. Please don't use these facilities unless you're happy (!) to allow your system to
  5. crash occasionally.
  6. The window isn’t fully integrated into the window handling system, so some odd behaviour can occur.
  7. To save or print any drawings, it’s necessary to copy them via the clipboard to an appropriate application.
  8.  
  9. draw/3 is an external built-in predicate that takes three arguments.
  10.  
  11. The first argument is the command number.
  12.  
  13. The second argument is the parameter.
  14.  
  15. The third argument is a result, which is not used.
  16.  
  17. The commands currently implemented and their arguments are described below.
  18.  
  19. Where no argument is specified, use the anonymous variable as a placeholder.
  20.  
  21.  
  22. Command    Explanation    Arguments
  23.  
  24. 1    open the graphics window:    <name>(Top,Left,Bottom,Right)
  25.  
  26. 2    close the graphics window    _
  27.  
  28. 3    draw a line:    line(StartX,StartY,EndX,EndY)
  29.  
  30. 4    draw a rectangle:    rect(Left,Top,Right,Bottom)
  31.  
  32. 5    draw text:    text(X,Y,TextAtom)
  33.  
  34. 6    set pen size:    penSize(Width,Height)
  35.  
  36. 7    set pen mode:    penMode(ModeNumber)
  37.  
  38. 8    set pattern:    penPattern(PatternNumber)
  39.  
  40. 9    set foreground colour    color(ColorNumber)
  41.  
  42. 10    set background colour    color(ColorNumber)
  43.  
  44. 11    erase window contents    _
  45.  
  46. 12    draw oval    oval(Left,Top,Right,Bottom)
  47.  
  48.  
  49. colorNumbers
  50.  
  51. 0 to 7
  52.  
  53. black,yellow,magenta,red,cyan,green,blue,white
  54.  
  55.  
  56. patterns
  57.  
  58. 1-38
  59.  
  60. see Inside Macintosh, Vol 1, p474
  61.  
  62.  
  63. modeNumber
  64.  
  65. 8-15
  66.  
  67. see Inside Macintosh, Vol 1, p169/170
  68.  
  69.  
  70. examples
  71. draw(1,'Graphics Window'(40,40,200,200),_). %open a window
  72.  
  73. draw(4,rect(20,20,180,200),_). %draw a rectangle
  74.  
  75. draw(2,_,_). %close the graphics window
  76.